package com.crowntit.domain.trade.adapter.repository;

import com.crowntit.domain.trade.model.aggregate.GroupBuyOrderAggregate;
import com.crowntit.domain.trade.model.aggregate.TradeOrderSettlementAggregate;
import com.crowntit.domain.trade.model.entity.*;
import com.crowntit.domain.trade.model.valobj.GroupBuyProgressVO;

import java.util.List;

public interface ITradeRepository {
    LockPayOrderEntity queryUnPayMarketTradeOrderByOutTradeNo(String source, String channel, String userId, String outTradeNo);

    GroupBuyProgressVO queryGroupBuyProgressByTeamId(String teamId);

    LockPayOrderEntity lockMarketTradeOrder(GroupBuyOrderAggregate groupBuyOrderAggregate);

    GroupBuyActivityEntity queryGroupBuyActivityByActivityId(Long activityId);

    Integer queryUserTakeOrderCount(String userId, Long activityId);

    GroupBuyTeamEntity queryGroupBuyOrderTeamByTeamId(String teamId);

    GroupBuyOrderListEntity queryUnPayMarketTradeOrderListByOutTradeNo(String source, String channel, String userId, String outTradeNo);

    boolean settlementMarketPayOrder(TradeOrderSettlementAggregate tradeOrderSettlementAggregate);

    boolean isScIntercept(String source, String channel);

    List<NotifyTaskEntity> queryUnExecutedNotifyTaskByTeamId(String teamId);

    List<NotifyTaskEntity> queryUnExecutedNotifyTaskList();

    int updateNotifyTaskStatus2SUCCESS(String teamId);

    int updateNotifyTaskStatus2ERROR(String teamId);

    int updateNotifyTaskStatus2RETRY(String teamId);

    boolean occupyTeamStockKey(String teamStockKey, String recoveryTeamStockKey, Integer target, Integer validTime);

    void recoveryTeamStockKey(String recoveryTeamStockKey, Integer validTime);
}
